import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import login from '../views/login/login.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/login.vue')
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/home/home.vue'),
    children: [
        {
          path: '/statistics',
          name: 'statistics',
          meta: {
            isShow: true,
            title: '首页'
          },
          component: () => import('../views/statistics/statistics.vue'),
        },
        {
          path: '/order',
          name: 'order',
          meta: {
            isShow: true,
            title: '订单列表'
          },
          component: () => import('../views/order/order.vue')
        },
        {
          path: '/admin',
          name: 'admin',
          meta: {
            isShow: true,
            title: '管理员'
          },
          component: () => import('../views/admin/admin.vue')
        }
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
